<?php 
/**
 * Enter description here...
 *	管理员添加模型
 * STATUS_DISABLE 0 
 * STATUS_ABLE 1 
 */
 class Images extends  CActiveRecord{
 	
 public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
   const STATUS_DISABLE=0;
   const STATUS_ABLE=1;
	 
	public function tableName()
	{
		return '{{sys_news}}';
	}
 	
 	public function rules()
	{
		return array(
			array('title', 'required','message'=>'不能为空'),
			array('keywords,type,path,content,images','safe'),
// 		    array('images', 'file', 'types'=>'jpg, gif, png'),
			
		);
	}
	
	
	
 	public function attributeLabels()
	{
		return array(
			'id' => 'Id',
			'userid' => 'Userid',
		    'title' => 'Title',
		    'keywords' => 'Keywords',
		    'content' => 'Content',
		    'inputtime' => 'Inputtime',
		    'updatetime' => 'Updatetime',
		    'images' => 'Images',
		    'path'=>'Path',
		    'type'=>'Type',
		     
		);
	}

	
 public function getTypeOptions() {		
		return array('8'=>'活动图片','9'=>'友情链接','10'=>'近期热点','20'=>'精彩截图','21'=>'游戏原画');
	}
	
	
 protected function beforeSave()
	{
		if(parent::beforeSave())
		{
			if($this->isNewRecord)
			{
				$this->inputtime=time();
				$this->updatetime=time();
				$this->userid=Yii::app()->user->id;
			}
			return true;
		}
		else
			return false;
	}
}
?>
